class HelloController < ApplicationController
	def index
		@unassigned_events = []
        if current_user != nil && current_user.permission != nil
        
		    @unassigned_events = Event.find_all_by_workordertype_id(current_user.permission.workordertypes, :conditions => { :starts_at => nil })
        
		if params[:order_by] == "priority"
			@unassigned_events = @unassigned_events.sort_by{ |h| [h['workordertype_id'],h['priority']]}			
		else
			@unassigned_events = @unassigned_events.sort_by{ |h| [h['workordertype_id'],h['due_date']]}
		end
			#get resource to add them on the view
			#@resourceOut = Resource.find(:all);
	    end
    end
end
